<?xml version="1.0" encoding="UTF-8"?>
<ui:composition template="/WEB-INF/templates/portalTemplate.xhtml"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:my="http://java.sun.com/jsf/composite/components">
	<ui:define name="content">
		<f:metadata>
			<f:event type="preRenderView"
				listener="#{homeBean.reloadSessionUser()}" />
		</f:metadata>
		<h:form>
			<rich:panel header="Mój profil">

				<h:panelGrid columns="2">
					<h:panelGroup>
						<h:graphicImage library="gfx" name="male_icon.png"
							rendered="#{sessionLoggedUser.user.sex ne 'K'}" />
						<h:graphicImage library="gfx" name="female_icon.png"
							rendered="#{sessionLoggedUser.user.sex eq 'K'}" />
					</h:panelGroup>
					<h:panelGroup>
						<h:outputText value="#{sessionLoggedUser.user.fullName}"
							class="blueHeader" />
						<h:panelGrid columns="1">
							<h:panelGroup>
								<h:outputLabel value="E-mail:" styleClass="label" />
								<h:outputText value="#{sessionLoggedUser.user.email}" />
							</h:panelGroup>
							<h:panelGroup>
								<h:outputLabel value="Województwo:" styleClass="label" />
								<h:outputText value="#{sessionLoggedUser.user.province}" />
							</h:panelGroup>
							<h:panelGroup>
								<h:outputLabel value="Miejscowość:" styleClass="label" />
								<h:outputText value="#{sessionLoggedUser.user.place}" />
							</h:panelGroup>
							<h:commandLink value="Zmień moje dane"
								action="/pages/oMnie.xhtml" />
							<h:commandLink value="Zmień hasło"
								action="/pages/zmianaHasla.xhtml" />
						</h:panelGrid>
					</h:panelGroup>
				</h:panelGrid>
				<br />
				<br />

				<h:panelGrid columns="1" columnClasses="pageText">

					<h:panelGroup rendered="#{permissionManagement.studentLogged}">
						<h:outputText value="Twoim nauczycielem jest "
							style="color:#009ed2"
							rendered="#{homeBean.currentTeacher != null}" />
						<a4j:commandLink value="#{homeBean.currentTeacher.fullName}."
							style="color:#009ed2"
							action="#{userInfoPopup.load(homeBean.currentTeacher.id)}"
							render="userInfoPopup"
							oncomplete="#{rich:component('userInfoPopup')}.show(); return false;"
							rendered="#{homeBean.currentTeacher != null}" />
					</h:panelGroup>

					<h:outputText value="#{_text.get('user.moj.profil.non.confirmed')}"
						rendered="#{!sessionLoggedUser.user.mailConfirmation}"
						styleClass="formMessage" />
					<h:commandLink value="Wyślij link ponownie"
						action="#{homeBean.sendConfirmationMail()}"
						rendered="#{!sessionLoggedUser.user.mailConfirmation}" />


					<h:outputText value="#{_text.get('teacher.moj.profil.info')}"
						rendered="#{permissionManagement.teacherLogged}" />

					<h:outputText value="#{_text.get('student.moj.profil.info')}"
						rendered="#{permissionManagement.studentLogged}" />

				</h:panelGrid>

			</rich:panel>

		</h:form>
		<ui:include src="/components/userInfo.xhtml" />

	</ui:define>
</ui:composition>